package com.ctgu.chatapp.model.Dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy.REPLACE
import androidx.room.Query
import com.ctgu.chatapp.model.pojo.Information
import kotlinx.coroutines.flow.Flow

@Dao
interface InformationDao {
    @Insert(onConflict = REPLACE)
    fun addInformation(information: Information)

    @Insert(onConflict = REPLACE)
    fun addFriendInformation(information: List<Information>)

    @Query("select * from Information where chatID = :chatId")
    fun getInformation(chatId: Long): Flow<Information>

    @Query("update information set profile = :profile where chatID = :chatId")
    fun updateProfile(profile: String, chatId: Int)
}